package conf

import (
	_ "github.com/go-sql-driver/mysql"
	"gopkg.in/yaml.v2"
	"io/ioutil"
	"os"
)

type Api_yaml struct{}

func (*Api_yaml) Read(fpath string, v interface{}) {
	yamlFile, _ := ioutil.ReadFile(fpath)
	if err := yaml.Unmarshal(yamlFile, v); err != nil {
		return
	}
	return
}
func (*Api_yaml) Write(fpath string, v interface{}) {
	out, err := yaml.Marshal(v)
	if err != nil {
		return
	}

	if err := ioutil.WriteFile(fpath, out, os.ModeType); err != nil {
		return
	}
	return
}
